﻿
using System.Collections.Generic;
using System.Data;
using System;
namespace ZHDJ.MobileInterface
{
    public partial class GetMassLineInfoDetail : AbstractBasePage
    {
        protected override OutParam BusinessProcess<InParam, OutParam>(InParam inParam)
        {
            // 业务逻辑返回的响应对象  
            MassLineInfoDetailOutParam result = new MassLineInfoDetailOutParam();
            MassLineInfoDetailInParam param = new MassLineInfoDetailInParam();
            string logMsg = "";
            bool isFlag = true;
                 
            try
            {
                param = inParam as MassLineInfoDetailInParam;
                if (string.IsNullOrEmpty(param.msg_id))
                {
                    result.code = "0";
                    result.desc = "ID不能为空";

                    isFlag = false;
                }

                if (param.type != "1" && param.type != "2" && param.type != "3" && param.type != "4" && param.type != "5" && param.type != "6")
                {
                    result.code = "0";
                    result.desc = "类别只能为1：民情日记、2：学习心得、3：先进典型、4：活动简报、5：整改方案、6：建章立制";

                    isFlag = false;
                }

                if(isFlag)
                {
                    result.data.content_url = CommonUtils.AppAddressEx + string.Format("html/InformationDetail.aspx?InfoType={0}&InfoID={1}", 
                                                   (Convert.ToInt32(param.type) + 12),param.msg_id); 
                }
                logMsg = result.desc;
            }
            catch (Exception ex)
            {
                result.code = "0";
                result.desc = "操作异常，多次出现请联系管理员"; 
                logMsg = ex.Message + ":" + ex.StackTrace;
            }

            CommonUtils.InsertMobileInterfaceLog(SystemCode +"-GetMassLineInfoDetailList", SerializeHelper.JsonSerializer<MassLineInfoDetailInParam>(param), logMsg); 
            return result as OutParam;
        }

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.Compare(Request.QueryString["Safe"], "False", true) == 0)
                ProcessRequest<MassLineInfoDetailInParam, MassLineInfoDetailOutParam>();
            else
                SafeProcessRequest<MassLineInfoDetailInParam, MassLineInfoDetailOutParam>();
        }
    }

    #region 请求参数
    public class MassLineInfoDetailInParam
    {
        /// <summary>
        /// 必填，1：民情日记、2：学习心得、3：先进典型、4：活动简报、5：整改方案、6：建章立制
        /// </summary>
        public string type
        { get; set; }

        /// <summary>
        /// 必填	资讯ID
        /// </summary>
        public string msg_id
        { get; set; } 
    }
    #endregion

    #region 结果参数
    public class MassLineInfoDetailOutParam
    {
        public MassLineInfoDetailOutParam()
        {
            code = "1";
            desc = "操作成功";
            data = new MassLineInfoDetail();
        }

        /// <summary>
        /// 返回结果 具体见接口返回对照码 1	成功 0	失败 2	请求非法 加密结果和传入的MD5字符串进行比较，如果相同则执行接口操作，否则返回1001错误响应码
        /// </summary>
        public string code
        { get; set; }

        /// <summary>
        /// 结果描述 成功和失败都需要
        /// </summary>
        public string desc
        { get; set; }

        /// <summary>
        /// 详情
        /// </summary>
        public MassLineInfoDetail data
        { get; set; }
    } 
     
    /// <summary>
    /// 详情
    /// </summary>
    public class MassLineInfoDetail
    {
        /// <summary>
        ///	详情HTML页面地址
        /// </summary>
        public string content_url
        { get; set; } 
    }
    #endregion 
}